<template>
    <a-table :dataSource="dataList" :loading="tableLoading" :pagination="false" bordered >
        <a-table-column title="文件名称">
            <template slot-scope="t,r,i" >
                <span> {{r.key}} </span>
            </template>
        </a-table-column>
        <!-- <a-table-column title="文件地址">
            <template slot-scope="t,r,i" >
                <span> {{r.value}} </span>
            </template>
        </a-table-column> -->
        <a-table-column title="操作">
            <template slot-scope="t,r,i" >
                <a @click="downloadFile(r)">文件下载</a>
            </template>
        </a-table-column>
    </a-table>
</template>
<script>
    import { postFormAction, downloadFile} from '@/api/manage'

    export default {
        name: "applyShowInfo",
        components: {
        },
        props:{
            procInstId: String,
            peopleId: String
        },
        created(){
        },
        data () {
            return {
                tableLoading: false,
                dataList: [],
            }
        },
        computed:{
        },
        methods: {
            getDataList(num){
                this.tableLoading = true
                postFormAction('/bj/createfile/createAndGetFile', {"proc_inst_id": this.procInstId, "ygid": this.peopleId, "num": num} ).then((res) => {
                    this.dataList = res
                    this.tableLoading = false
                })
            },
            downloadFile(r){
                downloadFile('/bj/createfile/download', r.value.substring(r.value.lastIndexOf("\\")+1), {"filePath": r.value} ).then((response) => {
                })
            }
        }
    }
</script>
